<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/jquery-layout/jquery.layout-latest.css}" rel="stylesheet"/>

<body class="gray-bg">
	<div class="container-div ui-layout-center">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="hc-form">
					<div class="select-list">
						<ul>
							<li>
								分析类型：
								<select id="analysisType"  name="analysisType"  style="width: 100px">
									<option value="1" >周末加班超8小时</option>
									<option value="2">月工时不足周末加班</option>
									<option value="3">月度工时不足8小时</option>
									<option value="4">周末加班不足8小时</option>
									<option value="5">周末加班工时异常处理</option>
									<option value="6">连续异常3天以上</option>
								</select>
							</li>
							<li>
								PDU：
								<select id="pdu"  name="pdu"  style="width: 100px" th:with="type=${@dict.getType('human_pdu')}">
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
								</select>
							</li>
							<li>
								地域：
								<select id="region"  name="region"  style="width: 100px" th:with="type=${@dict.getType('check_region')}">
									<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
								</select>
							</li>

							<li>
								<a class="btn btn-success btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-success btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>

				</form>
			</div>
			<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="po:board:add">
					<i class="fa fa-plus"></i> 新增
				</a>
				<a class="btn btn-success btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="po:board:edit">
					<i class="fa fa-edit"></i> 修改
				</a>-->
				<a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="po:board:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:role:export">
				<i class="fa fa-download"></i> 导出
				</a>
			</div>

			<div class="col-sm-12 select-table table-bordered">
			    <table class="table table-hover" id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
	<div th:include="include :: footer"></div>
	<script th:src="@{/ajax/libs/jquery-layout/jquery.layout-latest.js}"></script>
	<script th:src="@{/ajax/libs/jquery-ztree/3.5/js/jquery.ztree.all-3.5.js}"></script>
	<script th:inline="javascript">
		var editFlag = [[${@permission.hasPermi('worktime:data:edit')}]];
		var removeFlag = [[${@permission.hasPermi('worktime:data:remove')}]];
		var regions = [[${@dict.getType('check_region')}]];
		var pdus = [[${@dict.getType('human_pdu')}]];

		var prefix = ctx + "worktime/data";

		$(function() {
			$('body').layout({ west__size: 185 });
			initTable();
		});

		 $("#analysisType").change(function(){
			 initTable();
		  });

		function initTable(){
			var analysisType = $("#analysisType option:selected").val();
			$("#bootstrap-table").bootstrapTable('destroy');
			if(analysisType ==1){
				queryExtraGreater8Hours();
			}
			else if(analysisType ==2){
				queryLackHasExtra();
			}
			else if(analysisType ==3){
				queryLackWorktime();
			}
			else if(analysisType ==4){
			}
			else if(analysisType ==5){
			}
			else if(analysisType ==6){
			}
		}

	 	//表格超出宽度鼠标悬停显示td内容
		function paramsMatter(value, row, index) {
			var span = document.createElement("span");
			span.setAttribute("title", value);
			span.innerHTML = value;
			return span.outerHTML;
		}
		//td宽度以及内容超过宽度隐藏
		function formatTableUnit(value, row, index) {
			return {
				css: {
					"white-space": "nowrap",
					"text-overflow": "ellipsis",
					"overflow": "hidden",
					"max-width": "60px"
				}
			}
		}

		function queryLackWorktime() {
			var options = {
				url: prefix + "/list/queryLackWorktime",
				modalName: "PO",
				search: false,showExport: false,showColumns: false,
				showRefresh: false,showToggle: false,showHeader: false,
				showFooter: false,searchable: false,smartDisplay:false,
				showSearch:false,
				columns: [
				{checkbox: true},
				{field: 'po',title: 'PO编号'},
				{field: 'name',title: '姓名'},
				{field: 'month', title: '月份'},
				{field: 'oweServiceHours',title: '欠工时'},
				{field: 'hwPM',title: '华为PM'},
				{field: 'pdu',title: 'PDU'},
				{field: 'region',title: '地域'}
				]
			};
			$.table.init(options);
		}
		function queryLackHasExtra() {
					var options = {
						url: prefix + "/list/queryLackHasExtra",
						modalName: "PO",
						search: false,showExport: false,showColumns: false,
						showRefresh: false,showToggle: false,showHeader: false,
						showFooter: false,searchable: false,smartDisplay:false,
						showSearch:false,
						columns: [
						{checkbox: true},
						{field: 'po',title: 'PO编号'},
						{field: 'name',title: '姓名'},
						{field: 'month', title: '月份'},
						{field: 'oweServiceHours',title: '欠工时'},
						{field: 'extraHours',title: '加班工时'},
						{field: 'hwPM',title: '华为PM'},
						{field: 'pdu',title: 'PDU'},
						{field: 'region',title: '地域'}
						]
					};
					$.table.init(options);
				}

		function queryExtraGreater8Hours() {
		    var options = {
		        url: prefix + "/list/queryExtraGreater8Hours",
		        modalName: "PO",
		        search: false,showExport: false,showColumns: false,
		        showRefresh: false,showToggle: false,showHeader: false,
		        showFooter: false,searchable: false,smartDisplay:false,
		        showSearch:false,
		        columns: [
		        {checkbox: true},
		        {field: 'hwCode',title: '华为工号'},
		        {field: 'name',title: '姓名'},
		        {field: 'checkDate',title: '日期'},
		        {field: 'po',title: 'PO编号'},
		        {field: 'extraHours',title: '加班时长'},
		        {field: 'hwPM',title: '华为PM'},
		        {field: 'pdu',title: 'PDU'},
		        {field: 'region',title: '地域'},
		        {field: 'startDate',title: '开始日期'},
		        {field: 'endDate',title: '结束日期'}
		        ]
		    };
		    $.table.init(options);
		}

	</script>
</body>
</html>